package com.xxx.service;

import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * rocketmq消息消费者
 */
@Slf4j
@Component
@RocketMQMessageListener(
        topic = "test-topic",
        consumerGroup = "my-consumer-group",
        selectorExpression = "*"  // 消费所有tag，可指定特定tag
)
public class MessageConsumer implements RocketMQListener<String> {

    public void onMessage(String message) {
        log.info("收到普通消息: " + message);
        // 业务处理逻辑
    }

}
